import { defineAsyncComponent, markRaw } from 'vue'

export const useComponent = () => {
  const getCompWin = (key: string) => {
    // key = 's-select' 约定形式
    return markRaw(defineAsyncComponent(() => import(`../../comps/${key.substring(2)}/Comp.vue`)))
  }
  const getPropsWin = (key: string) => {
    // key = 's-select' 约定形式
    return markRaw(defineAsyncComponent(() => import(`../../comps/${key.substring(2)}/Props.vue`)))
  }

  return {
    getCompWin,
    getPropsWin
  }
}
